import { request } from '@gui-pkg/request';
// import { GetAccountInfoModel } from './model/accountModel';

enum Api {
  AccountList = '/api/data/sys/user/list',
  AccountDetails = '/api/data/sys/user/',
  // AllRoleList = '/sys_api/api/data/sys/dept/treeselect',
  AddUser = '/api/data/sys/user',
  EditUser = '/api/data/sys/user/edit',
  DelUser = '/api/data/sys/user/delete/',
  getDeptList = '/api/data/sys/dept/list',
  getDeptTree = '/api/data/sys/dept/treeselect',
  ResetPassword = '/api/system/user/updateUserPassword',
  getDictDataUrl = '/api/data/sys/dict/data/type/',
  resetPwd = '/api/data/sys/user/resetPwd',
}

const requestOptions = {
  //joinParamsToUrl: false,
  // withToken: false,
  //joinTime: false,
  //joinPrefix: false,
  isTransformResponse: false,
};

// 获取用户列表
export const getAccountList = (params) => {
  return request.get({ url: Api.AccountList, params });
};
export const getDictData = (param) => {
  return request.get({ url: Api.getDictDataUrl+param});
};

export const getEqTypeDictData = (param) => {
  return request.get({ url: Api.getDictDataUrl+'eq_type'});
};
export const getEqData = (param) => {
  return request.get({ url: Api.getDictDataUrl+'eq_type'});
};

// 根据用户编号获取详细信息
export const getAccountDetails = (params) => {
  return request.get({ url: Api.AccountDetails+params });
};

// 获取角色树
/*export const getAllRoleList = () => {
  return request.get<GetAccountInfoModel>({ url: Api.AllRoleList });
};*/

// 添加用户
export const addUser = (params) => {
  return request.post({ url: Api.AddUser, params });
};

// 修改用户
export const editUser = (params) => {
  return request.post({ url: Api.EditUser, params });
};

// 删除用户
export const delUser = (params) => {
  return request.get({ url: Api.DelUser+params });
};

// 获取组织列表
export const getDeptList = (params) => {
  return request.get({ url: Api.getDeptList, params });
};
export const getDeptTree = (params) => {
  return request.get({ url: Api.getDeptTree, params });
};
// 重置用户密码
export function resetPassword(params) {
  return request.post({ url: Api.ResetPassword, params });
}
export const resetPwd = (params) => {
  return request.post({ url: Api.resetPwd,params });
};
